package com.softa.web.controller.system;

import com.github.pagehelper.PageInfo;
import com.softa.service.system.LogService;
import com.softa.vo.DataGridResponse;
import com.softa.vo.QueryRequest;
import com.softa.web.controller.base.BaseController;
import com.softa.dao.model.SysLog;
import com.softa.utils.Constants;
import com.softa.vo.DataGridRequest;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * 日志
 * @author yangl
 * @version 2015年12月15日
 * @see LogController
 * @since 1.0
 */
@Controller
@RequestMapping("/log")
public class LogController extends BaseController {

    @Resource
    private LogService logService;
    
    @RequiresPermissions("log:view")
    @RequestMapping(method = RequestMethod.GET)
    public String list(Model model) {
        return Constants.MENU_MANAGE+"/log/list";
    }
    
    @RequiresPermissions("log:view")
    @RequestMapping(value="/listPage",method = RequestMethod.POST)
    @ResponseBody
    public DataGridResponse listPage(DataGridRequest request, QueryRequest queryRequest) {
        PageInfo<SysLog> pageResult = logService.queryLogByparam(request, queryRequest);
        return new DataGridResponse(pageResult);
    }

}
